<template>
	<el-dialog :visible.sync="addVisible" @close="closeDialog()" width="70%" :show-close='false' :append-to-body = "true" class="chartDialog" :closeOnClickModal='false'>
      <span slot="title" class="dialog-title">
          {{dialogTitle}}
          <el-button size="mini" @click="closeDialog()" class="popupClose">关闭</el-button>
      </span>
      <div class=" qualityControlChart qualityControlChartAdd" v-if="creatTaskStep==0 || creatTaskStep==5">
        <div class="containercontent" style="height:calc(100% - 40px);padding-top: 0;">
          <div class="seachTip selectw100">
            <div class="inlineblock verticalmiddle infoitem">
              <div class="inlineblock verticalmiddle">
                检测项目
              </div>
              <div class="inlineblock verticalmiddle informationItem">
                <el-select v-model="item" clearable filterable placeholder="请选择" size="mini" @change = "changeItem"  :disabled = "union == 'Y'" >
                  <el-option v-for="item in itemoptions" :key="item.id" :label="item.name" :value="item.id">
                  </el-option>
                </el-select>
              </div>
            </div>
            <div class="inlineblock verticalmiddle infoitem">
              <div class="inlineblock verticalmiddle">
                能力参数
              </div>
              <!--:disabled = "union == 'Y'"-->
              <div class="inlineblock verticalmiddle informationItem" style="width:calc(100% -50px)">
                <el-select v-model="abblity" filterable placeholder="请选择" size="mini" clearable  :disabled = "union == 'Y'" >
                  <el-option v-for="item in abilityBeanList" :key="item.id" :label="item.name" :value="item.id">
                  </el-option>
                </el-select>
              </div>
            </div>
            <div class="inlineblock verticalmiddle infoitem">
              <div class="inlineblock verticalmiddle">
                控制参数
              </div>
              <div class="inlineblock verticalmiddle informationItem">
                <el-select v-model="control" placeholder="请选择" size="mini" clearable @change = "changeControl" :disabled = "union == 'Y'">
                  <el-option v-for="(value, key) in controleData" :key="key" :label="value" :value="key"></el-option>
                </el-select>
              </div>
            </div>
            <div class="inlineblock verticalmiddle infoitem">
              <div class="inlineblock verticalmiddle">
                批次号
              </div>
              <div class="inlineblock verticalmiddle informationItem">
                <el-select v-model="batch" placeholder="请选择" size="mini" clearable :disabled = "union == 'Y'">
                  <el-option v-for="item in batchList" :key="item.code" :label="item.name" :value="item.code"></el-option>
                </el-select>
              </div>
            </div>
          </div>
          <div class="seachTip selectw100">
            <div class="inlineblock verticalmiddle infoitem">
              <div class="inlineblock verticalmiddle">
                开始时间
              </div>
              <div class="inlineblock verticalmiddle informationItem">
                <!-- <el-date-picker v-model="beginTime" type="month" placeholder="选择月"  size = "mini" style = "width:100%;" format="yyyy-MM"  value-format = "yyyy-MM" :clearable="false"></el-date-picker> -->
                <el-date-picker v-model="beginTime" type="date" placeholder="选择日期"   size = "mini" style = "width:100%;" :clearable="false"  value-format = "yyyy-MM-dd" ></el-date-picker>
              </div>
            </div>
            <div class="inlineblock verticalmiddle infoitem">
              <div class="inlineblock verticalmiddle">
                结束时间
              </div>
              <div class="inlineblock verticalmiddle informationItem">
                <!-- <el-date-picker v-model="endTime" type="month" placeholder="选择月"  size = "mini" style = "width:100%;" format="yyyy-MM"  value-format = "yyyy-MM" :clearable="false" ></el-date-picker> -->
                <el-date-picker v-model="endTime" type="date" placeholder="选择日期"  size = "mini" style = "width:100%;"  :clearable="false" value-format = "yyyy-MM-dd" ></el-date-picker>
              </div>
            </div>
            <div class="inlineblock basicRightDistanceA searchIcon">
              <el-button size="mini" @click="getQuaControlData">搜索</el-button>
            </div>
          </div>
          <div class="separaterowTable" style = "height:calc(100% - 58px)">
            <el-table :data="qualityControlChartData" style="width: 100%;height:calc(100% - 40px)" size="mini"  class="tableCon" @selection-change="handleSelectionChange" ref="multipleTable" :row-style="rowStyle">
              <el-table-column type="selection" min-width="100px" :selectable='selectInit'></el-table-column>
              <el-table-column label="序号" min-width="50px" type="index"></el-table-column>
              <el-table-column property="code" label="检测单号" min-width="100px"></el-table-column>
              <el-table-column property="sampleCode" label="样品编号" min-width="100px"></el-table-column>
              <el-table-column property="updateTime" label="日期" min-width="110px" :formatter="formatterUpdateTime"></el-table-column>
              <el-table-column property="data" label="值" min-width="100px"></el-table-column>
            </el-table>
            <div class="tableTittle" style="text-align: center;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;" :title = "allValue">
              <span>样本量：{{allValCounts}}个&nbsp;&nbsp;</span><span>{{allValue}}</span>
            </div>
          </div>
        </div>
         <div class="qualityControlChartFotter">
            <el-button type="primary" style="float: right;" class="chartBtn" @click="gotoNext()" size="mini">下一步</el-button>
            <el-button type="" style="float: right;" class="chartBtn" @click="gotoPrev()" size="mini">上一步</el-button>
        </div>
      </div>
      <div class="chartStepTwo" v-if="creatTaskStep==1" >
        <table class = "approvalList">
            <tr>
              <td class = "titleTd">控制参数</td>
              <td  colspan = "2">{{controlName}}</td>
              <td class = "titleTd">样本量</td>
              <td  colspan = "2">{{valCounts}}</td>
            </tr>
            <tr>
              <td class = "titleTd">值</td>
              <td  colspan = "5" style = "width:80%;">{{showValue}}</td>
            </tr>
            <tr>
              <td class = "titleTd">正态检验</td>
              <td  colspan = "5">爱泼斯——普利(Epps-Pulley)检验</td>
            </tr>
              <tr>
              <td class = "titleTd">P分位数</td>
              <td ><el-select v-model="nor"   size="mini" @change = "getNorCrituical($event,'change')" style="width:100%;">
                    <el-option v-for="item in norList" :key="item.value" :label="item.label" :value="item.value">
                    </el-option>
                  </el-select>
              </td>
              <td class = "titleTd hoverStyle" @click = "showPic('method1')">临界值</td>
              <td><el-input size = "mini" v-model="norCrituical" oninput = "value=value.replace(/[^\d.]/g,'')" @blur = "compareTep"></el-input></td>
              <td class = "titleTd">Tep值</td>
              <td style = "min-width:80px;"> {{Tep}} </td>
            </tr>
            <tr>
              <td class = "titleTd">结论</td>
              <td  colspan = "5">{{norMsg}}</td>
            </tr>
            <tr>
                <td class = "titleTd" >离群检验</td>
                <td colspan = "5">
                  <el-radio v-model="methodCode" label="CR02">格拉布斯(Grubbs)检验法</el-radio>
                  <el-radio v-model="methodCode" label="CR03">狄克逊(Dixon)检验法</el-radio>
                </td>
            </tr>
            <tr>
              <td class = "titleTd">上统计量</td>
              <td  colspan = "2">{{preData}}</td>
              <td class = "titleTd">下统计量</td>
              <td  colspan = "2">{{nextData}}</td>
            </tr>
              <tr>
              <td class = "titleTd">1-α (α : 检出水平)</td>
              <td ><el-select v-model="det"   placeholder="请选择" size="mini" @change = "getDetCrituical" v-if = "methodCode == 'CR02'" style = "width:100%;"  >
                  <el-option v-for="item in detList1" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
                <el-select v-model="det"   placeholder="请选择" size="mini" @change = "getDetCrituical" v-if = "methodCode == 'CR03'">
                  <el-option v-for="item in detList2" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </td>
              <td class = "titleTd hoverStyle"  @click = "showPic('method2')">临界值</td>
              <td><el-input size = "mini" v-model="detCrituical" oninput = "value=value.replace(/[^\d.]/g,'')" @blur = "getOutlier" ></el-input></td>
              <td class = "titleTd">离群值</td>
              <td>{{outLinerValue}}</td>
            </tr>
            <tr v-if="hasOutlier == 1">
                <td class = "titleTd">1-α* (α* : 剔除水平)</td>
              <td >
                <!--getStaOutCritical-->
                 <el-select v-model="del"   placeholder="请选择" size="mini" @change = "getStaOutCritical" v-if = "methodCode == 'CR02'" style = "width:100%;"  >
                  <el-option v-for="item in detList1" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
                <el-select v-model="del"   placeholder="请选择" size="mini" @change = "getStaOutCritical" v-if = "methodCode == 'CR03'">
                  <el-option v-for="item in detList2" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </td>
              <td class = "titleTd hoverStyle" @click = "showPic('method2')">临界值</td>
              <td><el-input size = "mini" v-model="staOutCritical" oninput = "value=value.replace(/[^\d.]/g,'')" @blur = "getJugStaOutlier"></el-input></td>
              <td class = "titleTd">统计离群值</td>
              <td> {{statisticalOutliers}} </td>
            </tr>
            <tr>
              <td class = "titleTd">结论</td>
              <td  colspan = "5">{{outlierMsg}}</td>
            </tr>
        </table>
        <div class="qualityControlChartFotter">
          <el-button type="primary" style="float: right;" class="chartBtn" @click="generateChart()" size="mini">下一步</el-button>
          <el-button type="" style="float: right;" class="chartBtn" @click="gotoPrev()" size="mini">上一步</el-button>
        </div>
      </div>
      <div class="chartStepTwo" v-if="creatTaskStep==6" >
        <div v-if="creatTaskStep==6">
            <table class = "approvalList" v-if = "FtVal == 1">
                 <tr>
                  <td class = "titleTd">原始数据值</td>
                  <td  colspan = "5">{{showValueOld}}</td>
                </tr>
                <tr>
                  <td class = "titleTd">样本量</td>
                  <td colspan = "5">{{valCountsOld}}</td>
                </tr>
                <tr>
                  <td class = "titleTd">新数据值</td>
                  <td  colspan = "5">{{showValue}}</td>
                </tr>
                 <tr>
                  <td class = "titleTd">样本量</td>
                  <td colspan = "5">{{valCounts}}</td>
                </tr>
                <tr>
                  <td class = "titleTd">F</td>
                  <td >{{F}}</td>
                   <td class = "titleTd">置信水平</td>
                  <td ><el-select v-model="mulDet"   placeholder="请选择" size="mini" @change = "getFCritical" style = "width:100%;"  >
                      <el-option v-for="item in mulList" :key="item.value" :label="item.label" :value="item.value">
                      </el-option>
                    </el-select>
                  </td>
                  <td class = "titleTd">临界值</td>
                  <td ><el-input size = "mini" v-model="FOutCritical" oninput = "value=value.replace(/[^\d.]/g,'')" @blur = "vliateFt"></el-input></td>
                </tr>
                <tr>
                  <td class = "titleTd">t</td>
                  <td>{{t}}</td>
                  <td class = "titleTd">置信水平</td>
                  <td ><el-select v-model="mulDel"   placeholder="请选择" size="mini" @change = "getTCritical" style = "width:100%;"  >
                      <el-option v-for="item in mulList" :key="item.value" :label="item.label" :value="item.value">
                      </el-option>
                    </el-select>
                  </td>
                  <td class = "titleTd">临界值</td>
                  <td ><el-input size = "mini" v-model="tOutCritical" oninput = "value=value.replace(/[^\d.]/g,'')" @blur = "vliateFt"></el-input></td>
                </tr>
                <tr>
                  <td class = "titleTd">结论</td>
                  <td  colspan = "5">{{Fmsg}} {{tmsg}}</td>
                </tr>
            </table>
            <table class = "approvalList" v-if = "FtVal == 2">
                 <tr>
                  <td class = "titleTd">原始数据值</td>
                  <td  colspan = "5">{{showValueOld}}</td>
                </tr>
                <tr>
                  <td class = "titleTd">样本量</td>
                  <td colspan = "5">{{valCountsOld}}</td>
                </tr>
                <tr>
                  <td class = "titleTd">新数据值</td>
                  <td  colspan = "5">{{showValue}}</td>
                </tr>
                 <tr>
                  <td class = "titleTd">样本量</td>
                  <td colspan = "5">{{valCounts}}</td>
                </tr>
            </table>
        </div>

        <div class="qualityControlChartFotter">
          <el-button type="primary" style="float: right;" class="chartBtn" @click="generateChart()" size="mini">下一步</el-button>
          <el-button type="" style="float: right;" class="chartBtn" @click="gotoPrev()" size="mini">上一步</el-button>
        </div>
      </div>
      <div class="qualityControlChartAdd"  v-if="creatTaskStep==3"  style = "text-align:center;line-height:100px;">
          <el-radio v-model="union" label="Y">合并</el-radio>
          <el-radio v-model="union" label="N">不合并</el-radio>
          <div class="qualityControlChartFotter">
            <el-button type="primary" style="float: right;" class="chartBtn" @click="gotoNext()" size="mini">下一步</el-button>
            <el-button type="" style="float: right;" class="chartBtn" @click="gotoPrev()" size="mini">上一步</el-button>
          </div>
      </div>
      <div class="qualityControlChartAdd"  v-if="creatTaskStep==4" style = "text-align:center;line-height:100px;">
          <el-radio v-model="FtVal" label="1">F、t检验</el-radio>
          <el-radio v-model="FtVal" label="2">3s判断</el-radio>
          <div class="qualityControlChartFotter">
            <el-button type="primary" style="float: right;" class="chartBtn" @click="gotoNext()" size="mini">下一步</el-button>
            <el-button type="" style="float: right;" class="chartBtn" @click="gotoPrev()" size="mini">上一步</el-button>
          </div>
      </div>
      <div class="chartStepTwo"  v-if="creatTaskStep==7 || creatTaskStep==2" >
        <div class="containercontent" style="height:100%;padding-top: 0;">
          <div style = "width:100%;height:40px;line-height:40px;">
            <div class="inlineblock" style = "width:30%;">
                总数:
              <div class="inlineblock" style = "width:calc(100% - 80px)">
                <el-input  disabled v-model="num" class="num" size = "mini"></el-input>
              </div>
            </div>
            <div class="inlineblock" style = "width:30%;">
                平均值:
              <div class="inlineblock" style = "width:calc(100% - 80px)">
                <el-input   v-model="avg" class="avg" size = "mini"  @blur = "calWarn('changeValue')"></el-input>
              </div>
            </div>
            <div class="inlineblock" style = "width:30%;">
                标准偏差:
              <div class="inlineblock" style = "width:calc(100% - 80px)">
                <el-input placeholder=""  v-model="dev" class="dev" size = "mini"  @blur = "calWarn('changeValue')"></el-input>
              </div>
            </div>
          </div>
          <div id="qualityPicture1" style="width:100%;height:calc(100% - 50px);margin:auto"></div>
        </div>

        <div class="qualityControlChartFotter">
          <el-button type="primary" style="float: right;" class="chartBtn" @click="saveChart()" size="mini">确定</el-button>
          <el-button type="" style="float: right;" class="chartBtn" @click="gotoPrev()" size="mini">上一步</el-button>
        </div>
      </div>
      <!--<el-dialog :visible.sync="pictureShow" width="70%" :show-close='false' :append-to-body = "true" class="chartDialog" :closeOnClickModal='true'>
         <img src="../../../../assets/img/bg.png">

      </el-dialog>-->
      <div v-if = "pictureShow" class = "picDiv">
          <div style = "height:40px;"><el-button size="mini" @click="pictureShow = false" class="popupClose">关闭</el-button></div>
          <div style = "height:calc(100% - 50px);width:100%;overflow-y:auto;text-align:center;">
             <img :src="picUrl" :class = "{'imgClass':!isBigImg,'bigImg':isBigImg}">
          </div>

      </div>
  </el-dialog>

</template>

<script>
	import { mapState } from 'vuex'
  import $ from 'jquery'
	export default {
		data() {
			let that = this;
			return {
				control: '',
        controlName:"",
				item: '',
				itemoptions:[],
				controleData: [],
				ct_month: [],
				abilityBeanList:[],
				abblity:"",
				beginTime:"",
				endTime:"",
        creatTaskStep:"0",
        dialogTitle:"离群检验",
        radio:'',
        batch:'',
        methodCodes:"CR01",
        methodCode:'CR02',
        nor:'0.95',
        norList:[{
            label:'0.90',
            value:'0.90',
          },{
            label:'0.95',
            value:'0.95',
          },{
            label:'0.975',
            value:'0.975',
          },{
            label:'0.99',
            value:'0.99',
          },
        ],
        norCrituical:'', //正态的Tep值
        norMsg:'', //正态结论
        preData:"", //上侧数据
        nextData:"",//下侧数据
        del:'0.99',
        det:'0.95',
        detList1:[{
            label:'0.90',
            value:'0.90',
          },{
            label:'0.95',
            value:'0.95',
          },{
            label:'0.975',
            value:'0.975',
          },{
            label:'0.99',
            value:'0.99',
          },
          {
            label:'0.995',
            value:'0.995',
          },
        ],
        detList2:[{
            label:'0.95',
            value:'0.95',
          },{
            label:'0.99',
            value:'0.99',
          }
        ],
        detCrituical:"", //离群检出临界值
        outLinerValue:"", //离群值
        hasOutlier:0,
        staOutCritical:"", //离群剔除水平临界值
        statisticalOutliers:"", // 统计离群值
        outlierMsg:"", //离群结论
        qualityControlChartData:[],
        datas:[],
        dataList:[],
        checkList:[],
        showValue:'',
        valCounts:0,
        Tep:'',
        msg:'',
        StaOutlier:'',
        calSuccess:false,
        avg:'',
        dev:'',
        num:'',
        union:'N', //是否合并
        FtVal:'2',
        mulDet:'0.95', //F检出水平
        mulDel:"0.95", //t检出水平
        mulList:[{
            label:'0.90',
            value:'0.90',
          },{
            label:'0.95',
            value:'0.95',
          },{
            label:'0.99',
            value:'0.99',
          },{
            label:'0.999',
            value:'0.999',
          }

        ],
        FOutCritical:'', //F的临界值
        tOutCritical:'', //t的临界值
        showValueOld:'',
        valCountsOld:0,
        datasOld:[],
        dataListOld:[],
        oldStep:'',
        FtSuccess:'',
        Fmsg:'',
        tmsg:'',
        F:'',
        t:'',
        batchList:[],
				pickerBeginDateBefore:{
					disabledDate(time) {
						return time.getTime() > Date.now();
					}
				},
				pickeroption:{
					disabledDate(time) {
						if (that.beginTime != '') {
							let startDate = new Date(that.beginTime);
							let endDate = Date.now() - 8.64e6;
							return (time.getTime() < startDate.getTime() - 8.64e7 || time.getTime() > Date.now());
						}
					}
				},
        allValue:"", //所有的数据
        allValCounts:0,//所有数据的长度
        params:{},
        pictureShow:false,
        picUrl:"",
        isBigImg:false,


			}
		},
		created() {
      // this.getdatatime();
      this.getControl();
		},
    props:["addVisible","creatTaskStepStatus","clearSymbol","detailsDataObj",],
    watch : {
        creatTaskStep:function(val) {
          console.log(val)
            if(val==0){
              this.dialogTitle = "第一步—选择样本";
              if(this.union == "N"){
                this.dataListOld = [];
              }

            }else if(val==1){
              this.dialogTitle = "第二步—正态离群检验";

            }else if(val==2){
              this.dialogTitle = "第三步—预览质控图";
            }else if(val==3){
              this.dialogTitle = "第一步—选择更新方式";
            }else if(val==4){
              this.dialogTitle = "第二步—选择检验方法";
              if(this.union == 'Y'){
                this.randerData()
              }
            }else if(val==5){
              this.dialogTitle = "第三步—选择新数据";
            }else if(val==6){
              if(this.FtVal == 1){
                this.getFCritical(this.mulDet); //计算F的临界值
                this.getTCritical(this.mulDel);//计算T的临界值
              }
              this.dialogTitle = "第四步—检验结果";

            }else if(val == 7){
              this.dialogTitle = "第五步-预览质控图";
            }
        },
        addVisible:function(val) {
          console.log(this.detailsDataObj)
          if(val){
            this.getControl();
            if(this.creatTaskStepStatus){
              this.creatTaskStep = this.creatTaskStepStatus;
            }

            if(this.detailsDataObj.detailsData){
              this.datasOld = this.detailsDataObj.detailsData;
              this.dataListOld = this.detailsDataObj.detailsDataList;
              this.valCountsOld = this.detailsDataObj.detailsData.length;
              this.showValueOld = this.detailsDataObj.detailsData.join(',');
              this.dev = this.detailsDataObj.dev;
              this.avg = this.detailsDataObj.avg;
              this.num = this.detailsDataObj.num;
            }
          }

        },
        creatTaskStepStatus:function(val){
          this.creatTaskStep = val;
        },
        methodCode(val){
          console.log(val)
          if(val !== ''){
            this.getCalOutlier();
          }
        },
        hasOutlier(val){
          if(val == 1){
            if(this.del !== ''){
                this.getStaOutCritical()  //离群临界值
            }
          }
        },
        item(val){
          if(val !='' && val != null){
            this.changeItem(this.item,"nochange")
          }
        },
        control(val){
          if(val !='' && val != null){
            this.changeControl(this.control,'nochange')
          }
        }


    },
		methods: {
      showPic(val){
         this.picUrl = "";
         this.isBigImg = false;
        if(val == "method1"){
          this.picUrl = require("../../../../assets/img/qcmethods.png")
        }else{
          if(this.methodCode == 'CR02'){ //格拉布斯
            this.picUrl = require("../../../../assets/img/qcmethod3.jpg")
            this.isBigImg = true;

          }else{
            this.picUrl = require("../../../../assets/img/qcmethod2.png")
          }

        }
        this.pictureShow = true;
      },
      formatterUpdateTime(row, column, cellValue){
        try{
          return cellValue.substring(0,cellValue.length-2);
        }catch(e){
          //TODO handle the exception
        }
      },
      // 更新质控图并且选中合并的时候 老数据默认勾选不可操作
      selectInit(row, index) {
        if(this.union == 'Y' && this.creatTaskStep == 5){

          this.dataListOld.find((item) => {
            if(item.ids == row.id){
              this.$set(row,'disabled',true)
            }
          });
          if(row.disabled){
            return false
          }else{
            return true
          }
        }else{
          return true
        }


			},
      // 控制参数
      getControl() {
      	this.$http({
      		method: 'post',
      		apiUrl: '/qc/getControl.htm',
      	}).then(res => {
      		if (res.code === 0) {
      			this.controleData = res.data;
      		}
      	})
      	this.$http({
      		method: 'post',
      		apiUrl: '/technology/readItemBeanList.htm',
      	}).then(res => {
      		if (res.code === 0) {
      			this.itemoptions = res.data;
      		}
      	})
      },
      // 上侧数据，下侧数据
      async getCalOutlier(){
        var arr = ['CR01']
        if(this.methodCode != '' && this.methodCode != null ){
          arr[1] = this.methodCode
        }
        var params = {
          datas:this.datas,
          methodCodes:arr,
          det:this.nor
        }
        let res1 = await this.$http({
            method: 'post',
            apiUrl: '/qc/calOutlier.htm',
            params: params,
            isJson: true,
        })

        if(res1.code == 0){
          if(res1.data.data1 != undefined && res1.data.data1 != null){
             this.preData = res1.data.data1
          }
          if(res1.data.data2 != undefined && res1.data.data2 != null){
             this.nextData = res1.data.data2
          }
        }

      },
      // 计算正态的临界值和结论
      async getNorCrituical(val,change){
        console.log(val)
        this.norCrituical = "";
        var data = {
          code:"CR01",
          num:this.valCts,
          confidence:val,
        };
        let res1 = await this.$http({
          method: 'post',
          apiUrl: '/qc/getCriticalValue.htm',
          params:data,
          isJson:false,
        })

        if (res1.code === 0) {
          if(res1.data != undefined && res1.data != null){
              this.norCrituical = res1.data;
            }else{
              this.norCrituical = "";
            }
        }

        if(change != undefined){
          this.norMsg = "";
          this.Tep = "";
          var arr = ['CR01']
          if(this.methodCode != '' && this.methodCode != null ){
            arr[1] = this.methodCode
          }
          var data1 = {
            datas:this.datas,
            methodCodes:arr,
            nor:val,
          };
          let res2 = await this.$http({
            method: 'post',
            apiUrl: '/qc/calNormal.htm',
            params:data1,
            isJson:true,
          })

          if(res2.code == 0){
              if(res2.data.Tep != undefined){
                this.Tep = res2.data.Tep;
              }
              if(res2.data.msg != undefined){
                this.norMsg = res2.data.msg
              }
              this.num = res2.data.num;
              this.dev = res2.data.dev;
              this.avg = res2.data.avg;
          }

        }
      },
      getcalNormal(val){
          return new Promise((resolve, reject) => {
              this.norMsg = "";
              this.Tep = "";
              var arr = ['CR01']
              if(this.methodCode != '' && this.methodCode != null ){
                arr[1] = this.methodCode
              }
              var data1 = {
                datas:this.datas,
                methodCodes:arr,
                nor:val,
              };
              this.$http({
                method: 'post',
                apiUrl: '/qc/calNormal.htm',
                params:data1,
                isJson:true,
              }).then(res => {
                  resolve(res)
              })
          })
      },
      // 临界值和tep比较 Tep值小则为验证通过
      compareTep(){
        if(this.norCrituical == "" || this.norCrituical == null){
          this.norMsg = "Epps-Pulley检验未查询到临界值,请查表或手动输入！"
        }else{
          if(Number(this.Tep) < Number(this.norCrituical)){
            this.norMsg = "检验通过"
          }else{
            this.norMsg = "检验不通过"
          }
        }

      },
      // 计算离群检出的临界值
      async getDetCrituical(val){
        this.detCrituical = "";
        this.outLinerValue = ""
        this.outlierMsg = "";
        this.hasOutlier = false;
        this.staOutCritical = "";
        this.statisticalOutliers = "";
        // 临界值
          var data = {
            code:this.methodCode,
            num:this.valCounts,
            confidence:val,
          };
          let res1 = await this.$http({
            method: 'post',
            apiUrl: '/qc/getOutCritical.htm',
            params:data,
            isJson:false,
          })

          if (res1.code === 0) {
            if(res1.data != undefined && res1.data != null){
              this.detCrituical = res1.data;
            }else{
              this.detCrituical = "";
            }

            this.getOutlier();
          }



      },
      // 计算离群值
      async getOutlier(){
         this.outLinerValue = ""
         this.outlierMsg = "";
         var arr = [];
          arr[0] = this.preData
          arr[1] = this.nextData
         // 离群值
          var data1 = {
            datas:this.datas,
            x1:arr,
            det:this.detCrituical,
          };
          let res1 = await this.$http({
            method: 'post',
            apiUrl: '/qc/jugOutlier.htm',
            params:data1,
            isJson:true,
          })
          if (res1.code === 0) {
            // 离群值
            if(res1.data.Outlier != undefined ){
                this.outLinerValue = res1.data.Outlier;

            }else{
              this.outLinerValue = ""
            }
            if(res1.data.msg != undefined){
              this.outlierMsg = res1.data.msg
            }
            // 是否有离群值
            this.hasOutlier = res1.data.hasOutlier;

          }

      },
      // 离群检验剔除临界值
      getStaOutCritical(){
         this.staOutCritical = ""
        if(this.del == ''){
          return;
        }
          var data = {
            code:this.methodCode,
            num:this.valCounts,
            confidence:this.del,
          };
         this.$http({
            method: 'post',
            apiUrl: '/qc/getStaOutCritical.htm',
            params:data,
            isJson:false,
          }).then(res => {
            if (res.code === 0) {
              if(res.data != undefined && res.data != null){
                this.staOutCritical = res.data;
              }else{
                this.staOutCritical = ""
              }

              this.getJugStaOutlier();

            }
          })
      },
      // 统计离群值
      getJugStaOutlier(){
        this.statisticalOutliers = "";
        this.outlierMsg = ""
        var arr = [];
          arr[0] = this.preData
          arr[1] = this.nextData
          // 临界值
          var data = {
            datas:this.datas,
            x1:arr,
            det:this.detCrituical, //离群检出水平临界值
            del:this.staOutCritical //离群剔除水平临界值

          };
         this.$http({
            method: 'post',
            apiUrl: '/qc/jugStaOutlier.htm',
            params:data,
            isJson:true,
          }).then(res => {
            if (res.code === 0) {
              if(res.data.StaOutlier != undefined){
                this.statisticalOutliers = res.data.StaOutlier;
              }
              if(res.data.msg != undefined){
                this.outlierMsg = res.data.msg;
              }
            }
          })
      },
      // 默认选中
      checkedData(){
        let rows = this.checkList;
        let self = this;
        setTimeout(function(){
          rows.forEach(row => {
            self.$refs.multipleTable.toggleRowSelection(row);
          });
        },500)
      },
      clearOldData(){
        this.control = '';
        this.item = '';
        this.abblity = "";
        this.beginTime = "";
        this.endTime = "";
        this.batch = '';
        this.batchList = [];
        this.qualityControlChartData = [];
        this.datas = [];
        this.dataList = [];
        this.checkList = [];
        this.showValue = '';
        this.valCounts = '';
        this.hasOutlier = '';
        this.datas = '';
        this.dataList = '';
      },
      // 处理选中的数据
      handleSelectionChange(val){
         this.checkList = val;
         let datas = [];
         let dataList = [];
        //  根据时间大小排序  小-大
         this.checkList.sort(function (a, b) {
           var aDate = new Date(a.updateTime).getTime();
           var bDate = new Date(b.updateTime).getTime()
          if (aDate < bDate) {
            return -1;
          } else if (aDate == bDate) {
            return 0;
          } else {
            return 1;
          }
        })
        for(let i=0;i<this.checkList.length;i++){
          let dataObj ={};
           let value = this.checkList[i].data?this.checkList[i].data:'';
           let code = this.checkList[i].code?this.checkList[i].code:'';
          //  datas.push(value);
           this.$set(this.checkList[i],'originTime',this.checkList[i].updateTime)
           dataList.push(this.checkList[i]);
         }
        //  console.log(this.dataListOld)
          //  取出老数据中的ids
         let arr1Ids = this.dataListOld.map(item => item.ids);
        // 过滤arr2中不包含arr1相同的id数组。 新勾选的数据
        const result = this.checkList.filter(item => !arr1Ids.includes(item.id));

         this.datas = result.map(item => item.data); //新数据的值
        // console.log(this.datas)
         this.valCounts = this.datas.length; //新数据的长度
         this.showValue = this.datas.join('  ,  '); //展示的新数据
         this.dataList = dataList; //所有选中的数据的列表(包括老的和新的)
         this.allValue = dataList.map(item => item.data).join('  ,  '); //所以的
         this.allValCounts = dataList.length;
      },
      // searchData
      // 合并的时候 默认把搜索添加渲染上
      randerData(){
        // this.detailsDataObj
        console.log(this.detailsDataObj)
        this.item = this.detailsDataObj.item;
        this.abblity = this.detailsDataObj.abblity;
        this.control = this.detailsDataObj.control;
        this.batch = this.detailsDataObj.batch;
      },

      // 下一步
      gotoNext(){
       if(this.creatTaskStep == 0){ //如果时第一步,验证必须勾选数据
          if(this.checkList.length == 0 ){
              this.$notify({
                type:"warning",
                message:"请选择数据",
                title:"警告"
              })
              return;
          }
          if(this.checkList.length < 8 ){
              this.$notify({
                type:"warning",
                message:"正态检验至少需要8个数据进行检验！",
                title:"警告"
              })
              return;
          }
            // 先验证勾选的数据 计算tep值 通过了计算其他
          this.getcalNormal(this.nor).then((res) =>{

            if(res.code == 0){

              this.getNorCrituical(this.nor);
              if(this.det !== ''){
                this.getDetCrituical(this.det);
              }
              if(this.methodCode !== ''){
                this.getCalOutlier();
              }
              this.creatTaskStep++;


              if(res.data.Tep != undefined){
                this.Tep = res.data.Tep;
              }
              if(res.data.msg != undefined){
                this.norMsg = res.data.msg
              }
              this.num = res.data.num;
              this.dev = res.data.dev;
              this.avg = res.data.avg;
            }
          })

        }else if(this.creatTaskStep==1){

          // this.creatTaskStep++;
        } else if(this.creatTaskStep==3){

          if(this.union!='Y'){ //不合并的话相当于新增
            this.abblity = "";
            this.item = "";
            this.batch = "";
            this.control = "";
            this.allValue = "";
            this.allValCounts = 0;

            this.qualityControlChartData = [];
            this.creatTaskStep = 0;
            this.oldStep = 3;
          }else{ //合并
            this.randerData();
            this.creatTaskStep = 4

          }
        }else  if(this.creatTaskStep==4){ //第四步搜索数据
           this.creatTaskStep++;
          this.getQuaControlData()
        } else if(this.creatTaskStep == 5 ){ //再第五步的点击下一步时
            if(this.valCounts == 0){
              this.$notify({
                type:"warning",
                message:"请选择新数据",
                title:"警告"
              })
              return;
            }
            if(this.FtVal == 1){ //如果为Ft检验，计算数值

              this.checkFt(); //计算Ft值

            }else{ //3s检验调用接口验证选的数据是否合适
              this.calWarn()
            }

        }else{
          this.creatTaskStep++;
        }
        console.log(this.creatTaskStep)

      },
      // 上一步
      gotoPrev(){
        if(this.creatTaskStep==0){
          if(this.oldStep){
            this.creatTaskStep = this.oldStep;
            this.oldStep = '';
          }
        }else {
          if(this.creatTaskStep==3){
            this.$emit('update:addVisible',false);
          }
          this.creatTaskStep--;
        }

        //清除数据
        if(this.creatTaskStep==0 || this.creatTaskStep==5){
          this.checkedData();
        }
      },
      getQuaControlData(){
        let params = {
          item : this.item,
          abblity : this.abblity,
          control : this.control,
          batch : this.batch,
          beginTime : this.beginTime,
          endTime : this.endTime,
        };
        this.$http({
        	method: 'post',
        	apiUrl: '/qc/queryChartData.htm',
          params: params,
          isJson: true,
        }).then(res => {
          if(res.code == 0){
            this.qualityControlChartData = res.data;
            if(this.creatTaskStep == 5){
              console.log(this.detailsDataObj.detailsDataList)
              // debugger;
              this.$nextTick(() =>{
                this.detailsDataObj.detailsDataList.forEach((i, index) => {
                  this.qualityControlChartData.forEach((j,index) => {
                    if (i.ids == j.id) {
                      this.$refs.multipleTable.toggleRowSelection(j);
                    }
                  })
                })
              })

            }
          }

        })
      },
			changeItem(val,change){
        if(change == undefined){
          this.abblity = ""
        }

				this.$http({
            method: 'post',
            apiUrl: '/technology/readDetectAndItemList.htm',
            params: { item: val },
            isJson: false,
        }).then(res => {
            if (res.code === 0) {
                this.abilityBeanList = res.data;
            }
        })
			},
      changeControl(val,change){
        if(change == undefined){
          this.batch = "";
        }
        for(var i in this.controleData){
          if(val == i){
            this.controlName = this.controleData[i]
          }
        }
        let self = this;
        if(val=='UN05'){
          this.$http({
              method: 'post',
              apiUrl: '/qc/getStandBatch.htm',
              params: { item: self.item,abblity:self.abblity},
              isJson: false,
          }).then(res => {
              if (res.code === 0) {
                  self.batchList = res.data;
              }
          })
        }else{
          self.batchList = [];
        }
      },
      clearChart(){
        $("#qualityPicture1").removeAttr("_echarts_instance_").empty();
      },
      // 计算Ft的值
      checkFt(){
        let params = {
          x1 : this.datasOld,
          x2 : this.datas,
          det: this.mulDet,
          del: this.mulDel
        };
        this.$http({
        	method: 'post',
        	apiUrl: '/qc/calFt.htm',
        	params: params,
        	isJson: true,
        }).then(res => {
          if(res.code == 0){
              this.creatTaskStep++;
              this.F = res.data.F;
              this.t = res.data.t;
              this.Fmsg = res.data.Fmsg
              this.tmsg = res.data.tmsg
              // this.FtSuccess = res.data.msg
          }
        })
      },
      // 计算F的临界值
      getFCritical(val){

        this.FOutCritical = ""
        var num = Number(this.valCounts) + Number(this.valCountsOld) - 2
        console.log(num)
        let params = {
          code:"CR05",
          num:num,
          confidence:val,
        };
        this.$http({
        	method: 'post',
        	apiUrl: '/qc/getFCritical.htm',
        	params: params,
        	isJson: false,
        }).then(res => {
          if(res.code == 0){
            if(res.data != undefined || res.data != null){
               this.FOutCritical = res.data
            }else{
              this.FOutCritical = ""
            }
          }
        })
      },
       // 计算t的临界值
      getTCritical(val){
        this.tOutCritical = ""
        var num = Number(this.valCounts) + Number(this.valCountsOld) - 2
        let params = {
          code:"CR04",
          num:num,
          confidence:val,
        };
        this.$http({
        	method: 'post',
        	apiUrl: '/qc/getTCritical.htm',
        	params: params,
        	isJson: false,
        }).then(res => {
          if(res.code == 0){
            if(res.data != undefined || res.data != null){
               this.tOutCritical = res.data
            }else{
              this.tOutCritical = ""
            }

          }
        })
      },
      // 验证FT值是否合格
      vliateFt(){
        console.log(this.FOutCritical,this.tOutCritical)
        if(this.FOutCritical == '' || this.FOutCritical == null){
          this.Fmsg = "F检验未查询到临界值，请手动输入;";
        }else{
          if(Number(this.F) <= Number(this.FOutCritical)){
            this.Fmsg = "两组数据的标准偏差不存在显著性差异;";
          }else{
            this.Fmsg = "两组数据的标准偏差存在显著差异;";
          }
        }
        if(this.tOutCritical == '' || this.tOutCritical == null){
          this.tmsg = "T检验未查询到临界值，请手动输入;";
        }else{
          if(Number(this.t) <= Number(this.tOutCritical) ){
              this.tmsg = "两组数据的平均值不存在显著性差异;"
          }else{
            this.tmsg = "两组数据的平均值存在显著差异;"
          }
        }


      },
      // 合并 并且选的是3s的验证方法时  传入新点和平均值,计算通过了 去下一步，否则重新选点
      calWarn(val){
        console.log(this.dataList)

        var params = {
          dataList:this.dataList,
          dev:this.dev,
          avg:this.avg,
        }
        this.$http({
          method: 'post',
          apiUrl: '/qc/calWarn.htm',
          params: params,
          isJson: true,
        }).then(res => {
          if (res.code === 0) {
            if(res.data.result){
              this.dev = res.data.dev
              this.avg = res.data.avg
              if(val == undefined){
                 this.creatTaskStep++;
              }else{
                setTimeout(() =>{
                 this.drawLine(res.data)
                },200)
              }

            }else{
              if(val == undefined){
                let str = res.data.info.split(";");
                let len = str.length;
                if(str[len-1] ==''){
                  len = len -1;
                }
                let info = "";
                for(let i=0 ;i<len ;i++){
                  let num = Number(i) + 1;
                  info = info +num + ")" + str[i] + " ; ";
                }
                this.$notify({
                  title:"警告",
                  message:info,
                  type:"warning"
                })
              }else{
                setTimeout(() =>{
                    this.drawLine(res.data)
                },200)
              }
            }

          }
        })
      },
      // 生成质控图按钮
			generateChart() {

        if(this.creatTaskStep == 6 &&  this.FtVal == 1){
          if(this.FOutCritical == '' || this.tOutCritical == '' ){
            this.$notify({
              title:"警告",
              message:"请输入临界值",
              type:"warning"
            })
            return;
          }

          if(Number(this.F) > Number(this.FOutCritical)){
               this.$notify({
                  title:"警告",
                  message:"未通过F检验，不能生成质控图！",
                  type:"warning"
               })
               return;
           }
          if(Number(this.t) > Number(this.tOutCritical) ){
               this.$notify({
                  title:"警告",
                  message:"未通过t检验，不能生成质控图！",
                  type:"warning"
               })
               return;
           }
        }
        console.log(this.norCrituical,this.detCrituical,this.statisticalOutliers )
        if(this.creatTaskStep == 1){ //没有统计离群值就为通过,
          // debugger;
          if(Number(this.Tep) >= Number(this.norCrituical)){
             this.$notify({
              title:"警告",
              message:"正态检验不通过",
              type:"warning"
            })
            return;
          }
          // 离群值为空的时候通过，如果离群值不为空，统计离群的临界值要有值，统计离群值为空才可以通过

          // 离群检验临界值为空或者统计离群值有值的时候不通过
         //临界值  detCrituical 离群值 outLinerValue   统计离群的临界值 staOutCritical   统计离群值 statisticalOutliers
          if(this.detCrituical == "" || this.detCrituical == null){
             this.$notify({
              title:"警告",
              message:"离群检验不通过",
              type:"warning"
            })
            return;
          }
          if(this.hasOutlier == 1 && (this.staOutCritical == "" || this.statisticalOutliers == null)){
            this.$notify({
              title:"警告",
              message:"临界值不能为空",
              type:"warning"
            })
            return;
          }
          if((this.statisticalOutliers != '' && this.statisticalOutliers != null && this.statisticalOutliers != undefined)){
             this.$notify({
              title:"警告",
              message:"离群检验不通过",
              type:"warning"
            })
            return;
          }
        }
        if(this.creatTaskStep == 1){
          this.creatTaskStep =2
        }
        if(this.creatTaskStep == 6){
          this.creatTaskStep = 7
        }
        // 组装参数
        let dataList = this.dataList;
        //  根据时间大小排序  小-大
        dataList.sort(function (a, b) {
           var aDate = new Date(a.originTime).getTime();
           var bDate = new Date(b.originTime).getTime()
          if (aDate < bDate) {
            return -1;
          } else if (aDate == bDate) {
            return 0;
          } else {
            return 1;
          }
        })
        let datas = [];
        dataList.forEach((item) =>{
          datas.push(item.data)
        })
        let params = {
          item : this.item,
          abblity : this.abblity,
          control : this.control,
          batch : this.batch,
          nor : this.nor,
          det : this.det,
          del : this.del,
          tep : this.Tep,
          dataList : dataList,
          datas:datas,
          num:dataList.length,
        }
        this.buildChart(params);

			},
      // 画图数据接口
      buildChart(params){

         this.$http({
          method: 'post',
          apiUrl: '/qc/buildChart.htm',
          params: {dataList:params.dataList},
          isJson: true,
         }).then(res => {
           if(res.code == 0){
            this.avg = res.data.avg;
            this.dev = res.data.dev;
            this.num = params.num;
            this.params = params;
            setTimeout(() =>{
              this.drawLine(res.data)
            },200)
           }
         })
      },
      saveChart(){
        this.params.avg = this.avg;
        this.params.dev = this.dev;
        console.log(this.params)

        this.$http({
        	method: 'post',
        	apiUrl: '/qc/saveChartData.htm',
        	params: this.params,
        	isJson: true,
        }).then(res => {
          if(res.code == 0){
            this.$notify({
                title:"成功",
                message:"保存成功！",
                type:"success"
              })
            this.closeDialog();
            this.$emit('update:addVisible',false)
            this.$parent.echartShow = false;
            this.$parent.getQuaControlData();
          }
        })
      },
      // 画图
			drawLine(data) {
      	var xData = []
        var yData = []
        // console.log(data)
        var yLineData = [];
        yLineData.push(data.hControl)
        yLineData.push(data.hLimit)
        yLineData.push(data.hWarn)
        yLineData.push(data.lControl)
        yLineData.push(data.lLimit)
        yLineData.push(data.lWarn)
        yLineData = yLineData.concat(data.data)
        console.log(yLineData)
        var tepArr = yLineData.sort(function(a,b){
          return a-b;
        })
        var yMin = tepArr[0]
        var yMax = tepArr[tepArr.length - 1]
        console.log(yMin,yMax)
         if(yMin < 0){
          var yMinAxis = (yMin * 1.2).toFixed(6)
        }else{
          var yMinAxis = (yMin * 0.8).toFixed(6)
        }
        if(yMax > 0){
          var yMaxAxis = (yMax * 1.2).toFixed(6)
        }else{ //如果最大值为负数 需要* 0.8 变为成大值
           var yMaxAxis = (yMax * 0.8).toFixed(6)
        }

      	for (var i in data.dataList) {
      		xData.push(data.dataList[i].originTime)
          yData.push(Number(data.dataList[i].data))
      	}
        console.log(data)
      	let qualityControlChart = this.$echarts.init(document.getElementById('qualityPicture1'))
      	// 绘制图表
      	qualityControlChart.setOption({
      		tooltip: {
      			trigger: 'axis',
      		},
           grid: {
              right: '15%',
            },

      		xAxis: {
      			show: false,
      			// type: 'category',
      			boundaryGap: false,
      			data: xData.map(function (str) {
                  str = str.split('.')[0]
                  return  str.replace(' ', '\n')
              }),
      			name: '测定频次',
      			nameLocation: 'center',

      		},
      		yAxis: {
      			type: 'value',
      			splitLine: {
      				show: false
      			},
      			name: '检测值',
            min: yMinAxis,
						max: yMaxAxis,
      		},
      		series: [
      			{
              name:'检测值',
      				type:'line',
      				data: yData,
      				markLine: {
      					symbol: 'none',//去掉箭头
                precision: 6,
      					data: [
      						{
      							yAxis: data.avg,
      							label: {
      								show: true,
      								formatter: '中心线(CL)(' + data.avg + ")",
      							},
      							lineStyle: {
      								type:'solid'
      							}

      						},
      						{
      							yAxis: data.hControl,
      							label: {
      								show: true,
      								formatter: '上行动限(AL)(' + data.hControl + ")",
                      // position:'left',
      							},
      							lineStyle: {
      								color: 'red'
      							}
      						},
      						{
      							yAxis: data.lControl,
      							label: {
      								show: true,
      								formatter: '下行动限(AL)(' + data.lControl + ")",
                      // position:'left',
      							},
      							lineStyle: {
      								color: 'red'
      							}

      						},
      						{
      							yAxis: data.hWarn,
      							label: {
      								show: true,
      								formatter:'上警告限(WL)(' + data.hWarn + ")",
                      // position:'middle',
      							},
      							lineStyle: {
      								color: '#faa646'
      							}
      						},
      						{
      							yAxis: data.lWarn,
      							label: {
      								show: true,
      								formatter: '下警告线限(WL)(' + data.lWarn + ")",
                      // position:'middle',
      							},
      							lineStyle: {
      								color: '#faa646'
      							}
      						},
      						{
      							yAxis: data.hLimit,
      							label: {
      								show: true,
      								formatter: '上1S线(' + data.hLimit + ")",
      							},

      						},
      						{
      							yAxis: data.lLimit,
      							label: {
      								show: true,
      								formatter: '下1S线(' + data.lLimit + ")",
      							},

      						},
      					],
      					lineStyle: {
      						color: '#409EFF'
      					},
      					label:
      					{
      						show: true,
      						//  formatter: '{a}',
      					}
      				},
      				itemStyle: {
      					normal: {
      						color: '#409EFF',
      						align: 'center',
      					}
      				},
      			}
      		]
      	});
      },
      closeDialog(){
        if(this.creatTaskStep==2){
          // this.clearChart();
        }
        this.creatTaskStep = 0;
        this.clearData();
        this.$emit('update:addVisible',false)
      },
      clearData(){
        this.control = '';
        this.item = '';
        this.ct_month = [];
        this.abilityBeanList = [];
        this.abblity = "";
        this.beginTime = "";
        this.endTime = "";
        this.creatTaskStep = "0";
        this.dialogTitle = "第一步—选择样本";
        this.radio = '';
        this.batch = '';
        this.methodCodes = "CR01",
        this.methodCode = 'CR02';
        this.qualityControlChartData = [];
        this.datas = [];
        this.dataList = [];
        this.checkList = [];
        this.showValue = '';
        this.valCounts = 0;
        this.Tep = '';
        this.msg = '';
        this.StaOutlier = '';
        this.calSuccess = false;
        this.avg = '';
        this.dev = '';
        this.num = '';
        this.union = 'N';
        this.FtVal = '2';
        this.mulDet = '0.95';
        this.mulDel = '0.95';
        this.showValueOld = '';
        this.valCountsOld = 0;
        this.oldStep = '';
        this.FtSuccess = '';
        this.Fmsg = "";
        this.tmsg = "";
        this.F = '';
        this.t = '';
        this.FOutCritical = "";
        this.tOutCritical = "";
        this.datasOld = '';
        this.dataListOld = [];
        this.batchList = [];

        this.norCrituical = ''; //正态的Tep值
        this.norMsg =''; //正态结论
        this.preData = ""; //上侧数据
        this.nextData ="";//下侧数据
        this.del = '0.99'; //
        this.det = '0.95';
        this.detCrituical = ""; //离群检出临界值
        this.outLinerValue = ""; //离群值
        this.hasOutlier = 0; //是否有离群值
        this.staOutCritical = ""; //离群剔除水平临界值
        this.statisticalOutliers = ""; // 统计离群值
        this.outlierMsg = ""; //离群结论
        this.allValCounts = 0;
        this.allValue = "";
        this.params = {};
        this.clearChart();
      },
      rowStyle({ row, rowIndex}) {
        if (row.data === this.hasOutlier) {
          return 'color:red'
        } else {
          return ''
        }
      },
		},
		computed: {
			...mapState(['enableStatus', 'tableHeightA']),
		},
	}

</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>
  .chartDialog .el-dialog {
      margin-top: 10vh !important;
      height: 80% !important;
  }
  .chartDialog .el-dialog .el-dialog__body{
    overflow: auto;
  }
  .chartDialog .approvalList{
    border-collapse:collapse;
    width:100%;
    table-layout:fixed
  }
  .chartDialog .approvalList th, .chartDialog .approvalList td{
    border: 1px solid #d3d3d3;
    text-align:center;
    height:40px;
    padding: 10px;
    word-wrap: break-word

  }
   .chartDialog  .picDiv{
      width:80%;
      height:80%;
      position:fixed;
      top:0;
      bottom:0;
      left:0;
      right:0;
      margin:auto;
      z-index:100;
      background:#fff;

  }
  .chartDialog  .picDiv .imgClass{
      width: 90%;
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      margin: auto;
  }
.chartDialog  .picDiv .bigImg{
    width: 90%;
     margin: auto;

}
  .chartDialog  .picDiv .closeDiv{
    width:80px;
    position:absolute;
    top:0;
    right:0
  }

  .chartDialog .approvalList .titleTd{
    background:#f7f7f7;
    width:20%
  }
  .chartDialog .approvalList .tdCon{
    width:30%
  }
  .qualityControlChartFotter {
      height:45px;
      line-height: 45px;
      width: 100%;
      text-align: right;
      position: absolute;
      bottom: 0;
      right: 0;
      padding-right: 15px;
      border-top: 1px solid #eee;
    }
    .qcForm .el-form-item{
      width: 48%;
      display:inline-block;
      margin-bottom:18px;
    }
    .hoverStyle{
      cursor: pointer;
    }
    .hoverStyle:hover{
      text-decoration:underline;
      color:#66b1ff;
    }
</style>
<style scoped>
	.qualityControlChart .seachTip .infoitem {
		width: calc(100%/4.5 + 15px);
		padding: 0;
	}

.qualityControlChartAdd{
   height: 100%;
   /* overflow: auto; */
}
.chartBtn{
  margin: 10px;
}
.chartStepTwo{
  height:100%;
}
.chartStepTwo button{
  margin-left: 1.25rem;
}
.paddingRight{
  padding-right: 1rem;
}
.paddingTop{
  padding-top: 1.25rem;
}
.chartStepTwo .inlineblock.verticalmiddle input{
  line-height: 28px;
}
.height35{
  height: 35px;
  line-height:35px;
}
</style>
